﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site1.Master" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebUI.WebForm1" %>

<asp:Content ContentPlaceHolderID="header" runat="server">
    <title>首页</title>
    <script src="../Scripts/jquery-3.7.1.min.js"></script>
    <script>
        function delFun(obj) {
            var name = $(obj).parent().parent().children().eq(0).text();
            return confirm(`您确定要删除 ${name} 吗？`);
        }
    </script>
</asp:Content>

<asp:Content ContentPlaceHolderID="mainContent" runat="server">
    <form id="form1" runat="server">
        <p></p>
        <p style="display: flex;">
            <asp:TextBox ID="TextBox1" runat="server" CssClass="form-control"></asp:TextBox>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="Button1" runat="server" Text="搜索" CssClass="btn btn-primary" OnClick="Button1_Click1" />
        </p>
        <div>
            <table class="table table-striped table-hover">
                <tr>
                    <th>姓名</th>
                    <th>卡号</th>
                    <th>余额</th>
                    <th>开户日期</th>
                    <th>联系电话</th>
                    <th>联系地址</th>
                    <th>操作</th>
                </tr>
                <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
                    <ItemTemplate>
                        <tr>
                            <td><%# Eval("name") %></td>
                            <td><%# Eval("cardid") %></td>
                            <td><%# Eval("moneynum") %></td>
                            <td><%# Eval("startdate") %></td>
                            <td><%# Eval("phone") %></td>
                            <td><%# Eval("address") %></td>
                            <td>
                                <asp:Button ID="Button2" runat="server" Text="编辑" CssClass="btn btn-secondary" CommandName="edit" CommandArgument='<%# Eval("clientid") %>' />
                                <asp:Button ID="Button3" runat="server" Text="删除" CssClass="btn btn-danger" OnClientClick="return delFun(this)" CommandName="del" CommandArgument='<%# Eval("cardid") %>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
            <br />
            <asp:Label ID="Label1" runat="server" Text="总共0条数据"></asp:Label>
            <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">首&nbsp;页</asp:LinkButton>&nbsp;&nbsp;
            <asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton2_Click">上一页</asp:LinkButton>&nbsp;&nbsp;
            <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click">下一页</asp:LinkButton>&nbsp;&nbsp;
            <asp:LinkButton ID="LinkButton4" runat="server" OnClick="LinkButton4_Click">尾&nbsp;页</asp:LinkButton>&nbsp;&nbsp;
        </div>
    </form>
</asp:Content>
